package com.ztesoft.sca.common;

import java.nio.file.Files;
import java.nio.file.LinkOption;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.nio.file.attribute.BasicFileAttributeView;
import java.nio.file.attribute.BasicFileAttributes;
import java.util.Calendar;
import java.util.Date;

public class MyFileTimeUtil {
	
		public static Date getCreateTime(String fullFileName){  
		   Path path=Paths.get(fullFileName);    
		   BasicFileAttributeView basicview=Files.getFileAttributeView(path, BasicFileAttributeView.class,LinkOption.NOFOLLOW_LINKS );  
		   BasicFileAttributes attr;  
		   try {  
		       attr = basicview.readAttributes();  
		       Date createDate = new Date(attr.creationTime().toMillis());  
		       return createDate;  
		   } catch (Exception e) {  
		      e.printStackTrace();  
		   }  
		  Calendar cal = Calendar.getInstance();  
		  cal.set(1970, 0, 1, 0, 0, 0);  
		  return cal.getTime();  
		}  
}
